package com.book.config;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.LineCaptcha;
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.lang.Snowflake;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author SuperYu  2024/8/13
 */
@Configuration
public class CodeConfig {

    @Bean
    public LineCaptcha lineCaptcha(){
        RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
        LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 90);
        lineCaptcha.setGenerator(randomGenerator);
        return lineCaptcha;
    }

    @Bean
    public Snowflake snowflake(){
        return new Snowflake();
    }
}
